import {request} from '@/utils/request'
import type {User} from "@/types/User";

/**
 * 用户登录接口
 * @param user
 */
export function userLogin(user: any) {
    return request({
        url: '/user/login',
        method: 'post',
        data: user
    })
}

/**
 * 用户注册接口
 * @param user
 */
export function userRegister(user: any) {
    return request({
        url: '/user/register',
        method: 'post',
        data: user
    })
}

/**
 * 用户查询接口
 */
export function userSelect(username:any, userAccount:any) {
    return request({
        url: '/user/search',
        method: 'POST',
        data:{
            username: username,
            userAccount: userAccount
        }
    })
}

/**
 * 用户更新接口
 * @param user
 */
export function userUpdate(user: any) {
    return request({
        url: '/user/update',
        method: 'post',
        data: user
    })
}

/**
 * 用户当前信息接口
 */
export function userCurrent():Promise<User> {
    return request({
        url: '/user/current',
        method: 'get'
    })
}


/**
 * 用户登出接口
 */
export function userLogout() {
    return request({
        url: '/user/logout',
        method: 'post'
    })
}
